import React from 'react'
import LoadableComponent from "@/utils/loadable"
import { Table, Tag, Space, Card, Button, Form } from 'antd';
import { UserOutlined } from '@ant-design/icons';
import { ESearchPanel, ETablePancel } from '../../yun-engine';
import EventHub from '../../yun-engine/EventHub'
import { unique } from '../../yun-engine/utils'





const params = {
  formLayout: {
    labelCol: {
      xs: { span: 24 },
      sm: { span: 7 },
      md: { span: 7 },
      lg: { span: 7 },
    },
    wrapperCol: {
      xs: { span: 24 },
      sm: { span: 17 },
      md: { span: 17 },
      lg: { span: 17 },
    },
    layout: 'horizontal' // horizontal | vertical | inline
  },
  formData: [
    {
      formType: 'Input', // Input | Input_Password | Input_TextArea | Input_Search
      field: "123433",
      value: "456789",
      // className: 'mr20 mb10',  //Input的选项框
      // label: null, //可选String | null | 或者不填为undefined,
      label: "用户",
      style: { width: 200 },
      placeholder: "input search text",
      prefix: <UserOutlined />,
      onChange: function (value, e) {
      }
    },
    {
      formType: 'Input_Password',
      field: "e124323",
      value: "两袖清风",
      label: "密码",
      className: 'mr20',
      style: { width: 200 },
      placeholder: "input search text",
      prefix: <UserOutlined />,
      onChange: function (value, e) {
      }
    },
    {
      formType: 'Input_Search',
      field: "e345345",
      value: "散瘀清风",
      label: "搜索",
      // className: 'mr20',
      style: { width: 200 },
      placeholder: "input search text",
      prefix: <UserOutlined />,
      onChange: function (value, e) {
      }
    },
    {
      formType: 'Input_TextArea',
      field: "1222323",
      value: "剥夺也介意",
      label: "搜索",
      // className: 'mr20',
      max: 4,
      style: { width: 200 },
      placeholder: "input search text",
      prefix: <UserOutlined />,
      onChange: function (value, e) {
      }
    },
    {
      formType: 'Select',
      field: "3ewret2456",
      value: "字节跳动",
      label: "公司名称",
      // className: "mr20",
      style: { width: '200px' },
      data: [
        { value: "字节跳动", text: "字节跳动" },
        { value: "阿里巴巴", text: "阿里巴巴" },
        { value: "腾讯", text: "腾讯" },
        { value: "京东", text: "京东" },
      ]
    },
    {
      formType: 'Switch',
      field: "34546da",
      value: "字节跳动",
      className: "mt20",
      label:null,
      style: { width: '200px' },
    },
    {
      formType: 'Button',
      field: "32456",
      value: "发布",
      type: 'primary',
      onClick: () => {
        EventHub.emit(unique.__RELEASE_TABLLE_LIST__, { data: [] })
      },
    },
    {
      formType: 'Button',
      field: "32456",
      value: "改变表格",
      type: 'primary',
      release: unique.__RELEASE_TABLLE_LIST__,
      onClick: (value, e, superParams) => {
        console.log("this", this)
        console.log("value,e,superParams", value, e, superParams)
      },
    },
    // {
    //   formType: 'CustomNode',
    //   node: function (props) {
    //     console.log(this);
    //     return <Table></Table>
    //   }
    // },
  ]

}



export default class Home extends React.Component {
  constructor(props) {
    super(props)
  }


  render() {
    return <> <ESearchPanel {...params} ></ESearchPanel>
      <ETablePancel subscribe={unique.__RELEASE_TABLLE_LIST__} ></ETablePancel>
    </>
  }
}



